/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entidad;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author pc
 */
@Entity
@Table(name = "showtime")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Showtime.findAll", query = "SELECT s FROM Showtime s"),
    @NamedQuery(name = "Showtime.findByShowtimeID", query = "SELECT s FROM Showtime s WHERE s.showtimeID = :showtimeID"),
    @NamedQuery(name = "Showtime.findByShowDate", query = "SELECT s FROM Showtime s WHERE s.showDate = :showDate"),
    @NamedQuery(name = "Showtime.findByShowTime", query = "SELECT s FROM Showtime s WHERE s.showTime = :showTime"),
    @NamedQuery(name = "Showtime.findByShowtimePrice", query = "SELECT s FROM Showtime s WHERE s.showtimePrice = :showtimePrice")})
public class Showtime implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "showtimeID")
    private Integer showtimeID;
    @Basic(optional = false)
    @NotNull
    @Column(name = "showDate")
    @Temporal(TemporalType.DATE)
    private Date showDate;
    @Basic(optional = false)
    @NotNull
    @Column(name = "showTime")
    @Temporal(TemporalType.TIME)
    private Date showTime;
    @Basic(optional = false)
    @NotNull
    @Column(name = "showtimePrice")
    private float showtimePrice;
    @JoinColumn(name = "movieID", referencedColumnName = "movieID")
    @ManyToOne(optional = false)
    private Movies movieID;
    @JoinColumn(name = "cinemaID", referencedColumnName = "cinemaID")
    @ManyToOne(optional = false)
    private Cinema cinemaID;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "showtime")
    private List<Seatshowtime> seatshowtimeList;

    public Showtime() {
    }

    public Showtime(Integer showtimeID) {
        this.showtimeID = showtimeID;
    }

    public Showtime(Integer showtimeID, Date showDate, Date showTime, float showtimePrice) {
        this.showtimeID = showtimeID;
        this.showDate = showDate;
        this.showTime = showTime;
        this.showtimePrice = showtimePrice;
    }

    public Integer getShowtimeID() {
        return showtimeID;
    }

    public void setShowtimeID(Integer showtimeID) {
        this.showtimeID = showtimeID;
    }

    public Date getShowDate() {
        return showDate;
    }

    public void setShowDate(Date showDate) {
        this.showDate = showDate;
    }

    public Date getShowTime() {
        return showTime;
    }

    public void setShowTime(Date showTime) {
        this.showTime = showTime;
    }

    public float getShowtimePrice() {
        return showtimePrice;
    }

    public void setShowtimePrice(float showtimePrice) {
        this.showtimePrice = showtimePrice;
    }

    public Movies getMovieID() {
        return movieID;
    }

    public void setMovieID(Movies movieID) {
        this.movieID = movieID;
    }

    public Cinema getCinemaID() {
        return cinemaID;
    }

    public void setCinemaID(Cinema cinemaID) {
        this.cinemaID = cinemaID;
    }

    @XmlTransient
    public List<Seatshowtime> getSeatshowtimeList() {
        return seatshowtimeList;
    }

    public void setSeatshowtimeList(List<Seatshowtime> seatshowtimeList) {
        this.seatshowtimeList = seatshowtimeList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (showtimeID != null ? showtimeID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Showtime)) {
            return false;
        }
        Showtime other = (Showtime) object;
        if ((this.showtimeID == null && other.showtimeID != null) || (this.showtimeID != null && !this.showtimeID.equals(other.showtimeID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidad.Showtime[ showtimeID=" + showtimeID + " ]";
    }
    
}
